package com.baor.controller;

import com.baor.domain.CarVo;
import com.baor.domain.OrderVo;
import com.baor.service.PayService;
import com.baor.utils.AjaxResult;
import com.netflix.discovery.converters.Auto;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/pay")
public class PayController {

    @Autowired
    private PayService payService;

    @RequestMapping("/pay")
    public AjaxResult<?> pay(@RequestBody List<CarVo> carVoList) {
        return payService.pay(carVoList);
    }

    @RequestMapping("/receive")
    public String receive(@RequestBody Map<String,Object> map){
        System.out.println(map);
        return payService.receive(map);
    }

    @RequestMapping("/two/{userId}/{superiorId}")
    public AjaxResult<?> two(@PathVariable Integer userId,@PathVariable Integer superiorId){
        System.out.println(userId + "  " + superiorId);
        return payService.two(userId,superiorId);
    }

}
